<include file="Public/header"/> 
<include file="Public/sidebar"/>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
       为<span style="color:red">{$group_data['title']}</span>分配权限
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
        <li class="active">Here</li>
      </ol>
    </section>
    <!-- Main content -->
    <section class="content">
    <form action="" method="post">
	<input type="hidden" name="id" value="{$group_data['id']}">	
      	<div class="box">
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example2" class="table table-bordered table-hover mailbox-messages">
                <tbody>
                <foreach name="rule_data" item="v">
                	<empty name="v['_data']">
						<tr class="group">
							<th width="10%">
								<label>
									{$v['title']}
									<input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
								</label>
							</th>
							<td></td>
						</tr>
                	<else />
						<tr class="group">
							<th width="10%">
								<label>
									{$v['title']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)">
								</label>
							</th>
							<td>
								<foreach name="v['_data']" item="n">
									<table class="table table-bordered mailbox-messages">
										<tr class="group">
											<th width="10%">
												<label>
													{$n['title']} <input type="checkbox" name="rule_ids[]" value="{$n['id']}" <if condition="in_array($n['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)">
												</label>
											</th>
											<td>
												<notempty name="n['_data']">
													<volist name="n['_data']" id="c">
														<label>
															&emsp;{$c['title']} <input type="checkbox" name="rule_ids[]" value="{$c['id']}" <if condition="in_array($c['id'],$group_data['rules'])">	checked="checked"</if> >
														</label>
													</volist>							
												</notempty>
											</td>
										</tr>
									</table>
								</foreach>
							</td>
						</tr>
                	</empty>
                </foreach>
				<tr>
					<th></th>
					<td>
						<input class="btn btn-success" type="submit" value="提交">
					</td>
				</tr>
                </tbody>
              </table>
            </div>
            <!-- /.box-body -->
      	</div>
      <!-- /.box -->
    </form>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
<include file="Public/footer"/>
<script>
function checkAll(obj){
    $(obj).parents('.group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
}
</script>